#常规排序
def max(number):
    a=1
    for num in number:
        if num > a:
            a=num
        else:
            b=num
    print("max=%d"%a)
    print("min=%d" %b)
#输入列表
def list():
    number=[]
    usrput=input("请输入需要添加的次数:")
    times=0
    while times<int(usrput):
        number.append(int(input("请输入需要添加的数字:")))
        times=times+1
    print("乱序:",number)
    return number
#冒泡法排序
def max_min(number):
    listLength=len(number)
    while listLength >0 :
        for i in range(listLength-1):
            if number[i] > number[i+1]:
                number[i]=number[i]+number[i+1]#存储
                number[i+1]=number[i]-number[i+1]#number[i+1]=number[i]
                number[i]=number[i]-number[i+1]
        listLength=listLength-1
    print("顺序(从小到大):",number)
    print("min=%d"%number[0])
    print("max=%d"%number[-1])


if __name__ == '__main__':
    max_min(list())
